package cn.falcon.fmobi.console.aop;

public enum ResultCode {
    /**
     * 广告主 	202xx
     * 订单		203xx
     * 策略		204xx
     * 创意		205xx
     */
    SUCCESS(200, "SUCCESS"),
    //代理商
    AGENT_REBATE_NOT_UPDATE(20901,"Service.err.agent.rebate.not.update"),
    AGENT_NAME_NOT_NULL(20902,"Service.err.agent.name.not.null"),
    AGENT_REBATE_MAX_MIX_LIMIT(20903, "Service.err.agent.rebate.max.mix.limit"),
    //人群模块
    AUDIENCE_NAME_NOT_NULL(20801,"Service.err.audience.not.null"),
    AUDIENCE_upload_err(20802,"Service.err.upload.err"),
    AUDIENCE_upload_check_err(20803,"Service.err.upload.check.err"),

    //推广计划模块
    PROMOTION_PLAN_DAILY_BUDGET(20701,"Service.err.promotion.budget.not.legal"),
    PROMOTION_PLAN_LENGTH_IS_NOT_LEGAL(20702,"Service.err.promotion.plan.length.is.not.legal"),
    PROMOTION_PLAN_INVALID_CAMPAIGN_ID(20703,"Service.err.promotion.invalid.campaign.id"),
    PROMOTION_PLAN_NAME_REPEAT(20704,"Service.err.promotion.name.repeat"),
    PROMOTION_PLAN_BUDGET_DAY_IS_NOT_LEGAL(20705,"Service.err.promotion.budget.day.is.not.legal"),
    PROMOTION_PLAN_MINI_MUM_FIFTY(20706,"Service.err.promotion.mini.mum.fifty"),

    // 广告主模块
    ADVERTISER_REPEAT(20201, "Service.err.advertiser.repeat"),
    ADVERTISER_NOT_FOUND(20202, "Service.err.advertiser.not.found"),
    ADVERTISER_NOT_AUTH(20203, "Service.err.advertiser.not.auth"),
    ADVERTISER_AMOUNT(20204, "Service.err.advertiser.amount"),
    ADVERTISER_AUDIT_NOT_SUCCESS(20205, "Service.err.advertiser.audit.not.success"),
    ADVERTISER_REBATE_CAN_NOT_CHANGE(20206, "Service.err.advertiser.rebate.can.not.change"),

    // 订单模块
    CAMPAIGN_REPEAT(20301, "Service.err.campaign.repeat"),
    CAMPAIGN_NOT_FOUND(20302, "Service.err.campaign.not.found"),
    CAMPAIGN_NOT_AUTH(20303, "Service.err.campaign.not.auth"),
    CAMPAIGN_PLATFORM_CAN_NOT_CHANGE(20304, "Service.err.campaign.platform.can.not.change"),
    CAMPAIGN_BUDGET_CAN_NOT_CHANGE(20305, "Service.err.campaign.budget.can.not.change"),
    CAMPAIGN_ADVERTISER_CAN_NOT_CHANGE(20306, "Service.err.campaign.advertiser.can.not.change"),
    CAMPAIGN_DAY_BUDGET_CAN_NOT_CHANGE(20307, "Service.err.campaign.day.budget.can.not.change"),
    CAMPAIGN_PLATFORM_NOT_ENABLE(20308, "Service.err.campaign.platform.not.enable"),
    CAMPAIGN_DAY_BUDGET_AMOUNT(20309, "Service.err.campaign.day.budget.amount"),
    CAMPAIGN_DAY_BUDGET_AMOUNT_UPDATE_RANGE(20310, "Service.err.campaign.day.budget.amount.update.range"),
    CAMPAIGN_BUDGET_AMOUNT(20311, "Service.err.campaign.budget.amount"),
    CAMPAIGN_BUDGET_AMOUNT_UPDATE_RANGE(20312, "Service.err.campaign.budget.amount.update.range"),
    CAMPAIGN_BUDGET_REMAIN_NOT_ENOUGH(20313, "Service.err.campaign.budget.remain.not.enough"),

    // 策略模块
    STRATEGY_NOT_FOUND(20400, "Service.err.strategy.not.found"),
    STRATEGY_PLAN_NOT_FOUND(20401, "Service.err.strategy.plan.not.found"),
    STRATEGY_NAME_EXIST(20401, "Service.err.strategy.name.exist"),
    STRATEGY_SPACE_NOT_FOUND(20402, "Service.err.strategy.space.not.found"),
    STRATEGY_CREATIVE_NOT_FOUND(20403, "Service.err.strategy.creative.not.found"),
    STRATEGY_TARGET_NOT_FOUND(20404, "Service.err.strategy.target.not.found"),
    STRATEGY_ADVERISTER_STATUS_NOT_VAILD(20405, "Service.err.strategy.adverister.status.vaild"),
    STRATEGY_ADVERISTER_AUDIT_STATUS_VAILD(20406, "Service.err.strategy.adverister.audit.status.vaild"),
    STRATEGY_PROMOIONT_PLAN_NOT_FOUND(20407, "Service.err.strategy.promoiont.plan.not.found"),
    STRATEGY_ADTYPE_NOT_FOUND(20408, "Service.err.strategy.adType.not.same"),
    STRATEGY_FORMAT_NOT_SAME(20409, "Service.err.strategy.format.not.same"),
    STRATEGY_SPACE_ID_NOT_CHANGE(20410, "Service.err.strategy.spaceId.not.change"),
    STRATEGY_CREATIVE_ID_NOT_CHANGE(20411, "Service.err.strategy.creative.not.change"),
    STRATEGY_PLAN_ID_NOT_CHANGE(20412, "Service.err.strategy.planId.not.change"),
    STRATEGY_PLAN_COUNT(20413, "Service.err.strategy.plan.count"),
    STRATEGY_WECHAT_DAYBUDGET_NOT_NULL(20414, "Service.err.strategy.wechat.dayBudget.not.null"),
    STRATEGY_WECHAT_DAYBUDGET_MIN_MAX(20415, "Service.err.strategy.wechat.dayBudget.min.max"),
    STRATEGY_WECHAT_DAYBUDGET_LESS_COST(20416, "Service.err.strategy.wechat.dayBudget.less.cost"),
    STRATEGY_WECHAT_DAYBUDGET_EDIT(20417, "Service.err.strategy.wechat.dayBudget.edit"),
    STRATEGY_UNITPRICE(20418, "Service.err.strategy.unitprice"),
    STRATEGY_WECHAT_UNITPRICE(20419, "Service.err.strategy.wechat.unitprice"),
    STRATEGY_STATUS_CHANGE(20420, "Service.err.strategy.status.change"),
    STRATEGY_WECHAT_TIME(20421, "Service.err.strategy.wechat.time"),



    // 定向模块
    TARGET_NAME_EXSIT(20500, "Service.err.target.name.exsit"),

    USER_CREATE_UPDATE_ERROR(20600,"Service.error.in.create.user"),

    //创意模块
    CREATIVE_NOT_FOUND(20601,"Service.err.creative.not.found"),
    CREATIVE_REPEAT(20602,"Service.err.creative.repeat"),
    CREATIVE_PROMOTION_PLAN_CHANGE(20603,"Service.err.creative.promotion.change"),
    CREATIVE_MARKTYPE_CHANGE(20604,"Service.err.creative.markType.change"),
    CREATIVE_ADSPACEID_CHANGE(20605,"Service.err.creative.adspace.change"),
    CREATIVE_ADFORMAT_CHANGE(20606,"Service.err.creative.adformat.change"),
    CREATIVE_PLATFORM_CREATIVE_ID_CHANGE(20607,"Service.err.third.party.creativeId.change"),
    CREATIVE_INTERACTION_CHANGE(20608,"Service.err.creative.interaction.change"),
    CREATIVE_ADVERTISERID_NULL(20609,"Service.err.creative.advertiserId.null"),

    //财务管理模块
    AMOUNT_REQUIRE_WHOLE_HUNDRED(20701,"Service.err.amount.require.whole.hundred"),
    AMOUNT_PREMIUM_TOO_MUCH(20702,"Service.err.amount.too.much"),
    ;

    private int value;

    private String desc;

    private static java.util.HashMap<Integer, ResultCode> mappings;

    private synchronized static java.util.HashMap<Integer, ResultCode> getMappings() {
        if (mappings == null) {
            mappings = new java.util.HashMap<>();
            for (ResultCode resultCode : ResultCode.values()) {
                mappings.put(resultCode.value, resultCode);
            }
        }
        return mappings;
    }

    public static ResultCode forValue(int value) {
        return getMappings().get(value);
    }

    ResultCode(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public boolean isEqual(ResultCode tip) {
        return this.value == tip.value;
    }
}
